package com.ssd.nbgroup.service;

import com.ssd.nbgroup.dao.LocationJpaRepository;
import com.ssd.nbgroup.dto.Location;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by liuyf on 2017/8/29.
 */
@Service
@Transactional
public class LocationServiceImpl {
    @Autowired
    private LocationJpaRepository locationJpaRepository;

    public List<Location> findAll()
    {
        return locationJpaRepository.findAll();
    }

    public boolean saveLocatiion(String lng,String lat){
        Location l=new Location();
        l.setLat(lat);
        l.setLng(lng);
        Location ll= locationJpaRepository.save(l);
        if(ll==null)
            return false;
        return true;
    }
}
